package com.zjb.demo.common.controller;

import com.zjb.demo.common.config.AppConfig;
import com.zjb.demo.common.domain.response.AjaxResult;
import com.zjb.demo.common.domain.response.Version;
import com.zjb.demo.common.domain.server.Server;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.noear.solon.annotation.Controller;
import org.noear.solon.annotation.Get;
import org.noear.solon.annotation.Inject;
import org.noear.solon.annotation.Mapping;

/**
 * @author 庄佳彬
 * @since 2023/12/23 15:40
 */
@Controller
@Api(tags = "版本信息")
public class VersionController {
    @Inject
    private AppConfig appConfig;

    @Get
    @Mapping("/version")
    @ApiOperation(value = "版本")
    public AjaxResult<Version> version() {
        return AjaxResult.success(new Version(appConfig.getName(), appConfig.getVersion(), appConfig.getBuildTime()));
    }

    @Get
    @Mapping("/monitor/server")
    @ApiOperation(value = "服务器信息")
    public AjaxResult<Server> server() {
        return AjaxResult.success(new Server());
    }
}
